{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【选择】如下代码的运行结果为：（ ）。  \n",
    "```\n",
    "import pandas as pd\n",
    "mySeries2=pd.Series([10,10], index=[\"a\",\"b\",\"c\",\"d\"]) \n",
    "mySeries2```\n",
    "A.NameError  \n",
    "B.ValueError  \n",
    "C.  \n",
    "```a    10\n",
    "b    10\n",
    "c    10\n",
    "d    10\n",
    "dtype: int64```     \n",
    "D.      \n",
    "```a    10\n",
    "b    10\n",
    "dtype: int64```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：B。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【判断】通过mySeries.index可查看mySeries的“显式index”，通过mySeries.value可查看mySeries的元素。（ ）\n",
    "\n",
    "A. √  \n",
    "B. ×"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：B。  \n",
    "解析：应该为mySeries.values。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import pandas as pd\n",
    "mySeries=pd.Series([10,9,8,7,6,5,4,3,2,1], index=[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\"]) \n",
    "mySeries[3:9:3]```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：   \n",
    "```\n",
    "d    7   \n",
    "g    4   \n",
    "dtype: int64```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【填空】如下代码的运行结果为：（ ）。 \n",
    "```\n",
    "import pandas as pd\n",
    "mySeries=pd.Series([1,2,3,4,5], index=[\"a\",\"b\",\"c\",\"a\",\"b\"])\n",
    "mySeries[[\"a\",\"b\"]]  ```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：\n",
    "```\n",
    "a    1\n",
    "a    4\n",
    "b    2\n",
    "b    5\n",
    "dtype: int64```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "mySeries1=pd.Series([1,2,3,4,5], index=[\"a\",\"b\",\"c\",\"d\",\"e\"]) \n",
    "mySeries2=mySeries1.reindex(index=[\"b\",\"c\",\"a\",\"d\",\"e\"])\n",
    "np.all(mySeries2.values==mySeries1.values)```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：False。   \n",
    "解析：在reindex过程中，mySeries1本身并未改变。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "mySeries1=pd.Series([1,2,3,4,5], index=[\"a\",\"b\",\"c\",\"d\",\"e\"]) \n",
    "mySeries2=mySeries1.reindex(index=[\"b\",\"c\",\"a\",\"f\",\"g\"])\n",
    "np.any(np.isnan(mySeries2))```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：True。"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
